#include "Session.h"

#include "Helpers.h"

Session& Session::operator=( const Session& other )
{
  if (this == &other)
    return *this;
  m_id = other.m_id;  
  m_committeeId = other.m_committeeId;  
  m_date = other.m_date;
  return *this;
}

bool Session::operator==( const Session& other ) const
{
  return m_id == other.m_id &&
    m_committeeId == other.m_committeeId &&
    m_date == other.m_date;
}

std::ostream& operator<<( std::ostream& stream, const Session &session )
{
  return stream << 
    session.id() << c_delm <<
    session.committeeId() << c_delm <<
    session.date() << std::endl;
}

std::istream& operator>>( std::istream& stream, Session& session )
{
  CsvRow row;
  stream >> row;
  if (row.empty())
    return stream;
  session = Session(row[0], row[1], as<time_t>(row[2]));
  return stream;
}